From: Florian Müllner Date: Tue, 21 Mar 2023 00:00:07 +0000 (+0100) Subject: ci: Make sure to always clear meson-install checkout dir X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~371^2^2~13 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=fac05b182cd3e19199014e35fd5387a32d98d11e;p=gnome-shell.git ci: Make sure to always clear meson-install checkout dir We currently remove the directory at the end of the script, but that code is only reached when all previous operations were successful. Address this by first using an absolute directory path in /tmp instead of a "random" location based on the CWD, then set a trap to remove it on exit. Part-of: --- diff --git a/.gitlab-ci/install-meson-project.sh b/.gitlab-ci/install-meson-project.sh index df188673c..fbb62b9d0 100755 --- a/.gitlab-ci/install-meson-project.sh +++ b/.gitlab-ci/install-meson-project.sh @@ -31,14 +31,13 @@ COMMIT="$2" SUBDIR="$3" PREPARE="$4" -REPO_DIR="$(basename ${REPO_URL%.git})" +CHECKOUT_DIR=$(mktemp --directory) +trap "rm -rf $CHECKOUT_DIR" EXIT -git clone --depth 1 "$REPO_URL" -b "$COMMIT" -pushd "$REPO_DIR" -pushd "$SUBDIR" +git clone --depth 1 "$REPO_URL" -b "$COMMIT" "$CHECKOUT_DIR" + +pushd "$CHECKOUT_DIR/$SUBDIR" sh -c "$PREPARE" meson setup --prefix=/usr _build "${MESON_OPTIONS[@]}" meson install -C _build popd -popd -rm -rf "$REPO_DIR"